//
//  XJLabelTextField.m
//  XinJiangMall
//
//  Created by RaoBo on 2018/5/23.
//  Copyright © 2018年 Tzyang. All rights reserved.
//

#import "XJLabelTextField.h"

@implementation XJLabelTextField

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (instancetype)initWithFrame:(CGRect)frame keyType:(UIKeyboardType)type textEntry:(BOOL)entry leftTitle:(NSString *)title placeholder:(NSString *)placeholder {
    self = [super initWithFrame:frame];
    
    if (self) {
        // 左边label 修改x轴坐标无效
        UILabel *leftLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 100, 50)];
        leftLabel.text = title;
        self.leftView  =leftLabel;
        self.leftViewMode = UITextFieldViewModeAlways; // 不写不显示
        
        //tf
        self.placeholder = placeholder;
        self.keyboardType  = type;
        self.secureTextEntry = entry;
        self.clearButtonMode = UITextFieldViewModeAlways;
        self.returnKeyType = UIReturnKeyDefault;
        
        
        // 下划线
        UIView *bottomLine = [[UIView alloc] initWithFrame:CGRectMake(0, frame.size.height-0.5, frame.size.width, 0.5)];
        bottomLine.backgroundColor = [UIColor lightGrayColor];
        [self addSubview:bottomLine];
    }
    
    return self;
}

@end
